//
//  vdButton.h
//  Void Dead
//
//  Created by Sidney Just on 08.12.09.
//
//  Copyright © 2009 by Sidney Just
//  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
//  documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
//  the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 
//  and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
//  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
//  PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
//  FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
//  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#import <Foundation/Foundation.h>

#import	"vdShape.h"
#import "vdTexNode.h"
#import "vdKernel.h"
#import "vdNode.h"
#import "vdTexManager.h"

/**
 * This class represents a button with a texture which notifies a given selector when there was a touch inside the button.
 * <br>If you want to use buttons, you must add these buttons as children to a vdGUINode, so they can get touch messages.
 **/
@interface vdButton : vdShape <vdGUIProtocol> {
	//\cond
	BOOL enabled;
	
	vdTexNode *stateNormal;
	
	vdTexNode *statePressed;
	
	vdTexNode *stateDisabled;
	
	id pressedDelegate;
	
	BOOL pressed;
	// \endcond
}

/**
 * Set this to NO if the button should'nt be enabled. If a disabled image is specified, this will be shown instead of the normal image.
 * <br>The default value is YES
 **/
@property BOOL enabled;

/**
 * Sets the Image for the normal button state.
 @param tex The texture that should be shown for the state or NULL
 **/
- (void)setNormalState:(vdTexNode *)tex;

/**
 * Sets the Image for the pressed button state.
 @param tex The texture that should be shown for the state or NULL
 **/
- (void)setPressedState:(vdTexNode *)tex;

/**
 * Sets the Image for the disabled button state.
 @param tex The texture that should be shown for the state or NULL
 **/
- (void)setDisabledState:(vdTexNode *)tex;

/**
 * Sets the delegate for the button. The delegate will be notified if a touch ended over this button (touchUpInside)
 @param del The delegate
 @remark The delegate must implement the vdInterfaceProtocol!
 **/
- (void)setDelegate:(id)del;

/**
 * Returns a pointer to a new Button with the given textures.
 @param nstate Texturename of the normal state (will be loaded via the vdTexManager)
 @param pstate Texturename of the pressed state (will be loaded via the vdTexManager)
 **/
- (id)initWithNormalState:(NSString *)nstate andPressedState:(NSString *)pstate;


@end
